//1. 引入express
const express = require('express')
const {userRouter} = require('./router/user.js')
const {goodsRouter} = require('./router/goods.js')

// 2. express应用实例
const app = express()

// 3. 配置解析body参数
// key-value   json格式
app.use(express.json()) // 处理json格式数据  {username:admin}
app.use(express.urlencoded({extended:false})) // 处理key-value username=admin

// 3. 集成路由
app.use(userRouter)
app.use(goodsRouter)

app.listen(3000,()=>console.log('启动服务成功，监听3000端口!'))